/**
 * 
 */
package org.braketester.model.containering;

import java.io.Serializable;

/**
 * @author LAP
 *
 */
public class MassItem implements Serializable{
	private static final long serialVersionUID = -3821810312480378107L;
	private Double voltage;
	private Double delta;
	private boolean massInNeutons;
	
	public Double getVoltage() {
		return voltage;
	}
	
	public void setVoltage(Double voltage) {
		this.voltage = Math.abs(voltage);
	}
	
	public Double getDelta() {
		return delta;
	}
	
	public boolean isMassInNeutons() {
		return massInNeutons;
	}
	
	public void setMassInNeutons(boolean flag) {
		this.massInNeutons = flag;
	}
	
	public MassItem(Double voltage, Double mass) {
		if (mass == 0) throw new IllegalArgumentException("Mass must be positiv and not zero");
		massInNeutons = false;
		setVoltage(voltage);
		delta = getVoltage() / Math.abs(mass);
	}
	
	@Override
	public String toString() {
		return "in neutons: "+ massInNeutons + " Voltage: " + voltage.toString() + " Delta: " + delta.toString(); 
	}
}
